
public class NodoHashLista extends Nodo
{
    public NodoHashLista sgteNodo;
   
    public NodoHashLista(int value, NodoHashLista next)
    {
        super(value);
        this.sgteNodo = next;
    }

    @Override
    public void insert(int key)
    {
       if(this.value > key)
       {
           int aux = value;
           value = key;
           key = aux;
       }
       if(sgteNodo == null) {
            sgteNodo = new NodoHashLista(key, null);
        }
       else {
            sgteNodo.insert(key);
        }
    }

    @Override
    public boolean search(int key)
    {
        if(this.value == key){
            Hashing.comparaciones++;
            return true;
        }
        else if(sgteNodo == null){
            Hashing.comparaciones++;
            return false;
        }
        else{
            Hashing.comparaciones++;
            return sgteNodo.search(key);
    }}

    @Override
    public void imprimir()
    {
        System.out.print(" "+this.value);
        if(sgteNodo != null)
            sgteNodo.imprimir();
    }
}
